import axios from 'axios';

// 获取标签
export const getTag = () =>
    axios.get('/m1/story/getNovelTagList', {
        params:
        {
            type: '悬疑灵异',
        }
    })

// 标签详情
export const detailTag = (tags: String, sortBy: String, pageNo: String) =>
    axios.get('/m1/search/searchByTags?pageSize=10&direction=desc', {
        params:
        {
            pageNo: pageNo,
            // sortBy: 'visit',
            // sortBy: 'updateTime',
            sortBy: sortBy,
            tags: tags,
        }
    })


//类型详情-书库推荐    
export const typeRecommend = (type: string) =>
    axios.post('/m1/recommend/listpageNew',
        {
            columnId: '8217',
            pageNo: '1',
            pageSize: '4',
            type: type
        },
        {
            headers: {
                'content-type': 'application/x-www-form-urlencoded'
            }
        })


// 类型详情-类型
export const typeChoose = () =>
    axios.get('/m1/recommendtag/getOne?channel=1')


// 类型详情-选择类型
export const chooseType = (
    pageNo: String,
    tag: String,
    sort: String,
    type: String,
    option: String
) =>
    axios.post('/m1/recommendtag/search',
        {
            pageNo: pageNo,
            pageSize: '10',
            channel: '1',
            tag: tag,
            sort: sort,
            source: '1',
            type: type,
            option: option
        },
        {
            headers: {
                'content-type': 'application/x-www-form-urlencoded'
            }
        })


// 书城-精选-本期热销/新书速递
export const currentHots = (columnId: String, pageNo: String) =>
    axios.post('/m1/recommend/listpageNew',
        {
            columnId: columnId,
            pageNo: pageNo,
            pageSize: '10',
            channel: '1'
        },
        {
            headers: {
                'content-type': 'application/x-www-form-urlencoded'
            }
        }
    )


// 书城-精选-小编推荐
export const smallView = (pageNo:String) =>
    axios.get('/m1/recommend/smallCompileList?pageSize=10',{
        params: {
            pageNo: pageNo
        }
    })



// 书城-男频免费
    export const Manfree = () =>
    axios.get('/m1/novelColumnFree/getUsedList',{
        params: {
            channel: '1',
            model: '男频免费'
        }
    })


// 书城-新书
export const newBookType = (
    pageNo: String,
    tag: String,
    sort: String,
    type: String,
    option: String,
) =>
    axios.post('/m1/story/listpageNew',
        {
            pageNo: pageNo,
            pageSize: '10',
            channel: '1',
            tag: tag,
            sort: sort,
            type: type,
            option: option,
            model: '4'

        },
        {
            headers: {
                'content-type': 'application/x-www-form-urlencoded'
            }
        })


// 搜索热词
export const getHotwords = () =>
    axios.get('/m1/search/keywords')


// 搜索关键词
export const getKeywords = (keyword: any) =>
    axios.get('/m1/search/searchNames',{
        params: {
            keyword: keyword
        }
    })

// 选择搜索的关键词
export const SearchWords = (keyword: any, pageNo: String) =>
    axios.get('/m1/search/searchByWord',{
        params: {
            keyword: keyword,
            pageNo: pageNo,
            pageSize: '10'
        }
    })



// 专题详情
export const getTopic = (topicId: any) =>
    axios.get('/m1/topic/get',{
        params: {
            topicId: topicId    
        }
    })



// 专题列表
export const getTopicList = (page: any) =>
    axios.get('/m1/topic/listnew?channel=1&pageSize=10',{
        params: {
            page: page    
        }
    })


